#include "main/utils.h"
using namespace std;

bool isAnagram(const string &s, const string &t) {
  if (s.length() != t.length())
    return false;

  vector<int> vec(26, 0);
  for (auto ele : s) {
    int idx = ele - 'a';
    ++vec[idx];
  }
  for (auto ele : t) {
    int idx = ele - 'a';
    if (vec[idx] == 0)
      return false;
    --vec[idx];
  }
  return true;
}

int main() {
  string s = "anagram";
  string t = "nagaram";
  bool ret = isAnagram(s, t);
  cout << ret << endl;

  return 0;
}
